package qmlt.learning.neuralnetwork.node;

public class InputNode extends Node
{

    public InputNode(String id)
    {
        super(id);
        weights.set(0, (float) 1);
    }

    @Override
    public void feedForward()
    {
        assert (inputs.size() == weights.size());

        unthreshOutput = inputs.get(0);

        for (Edge e : outlinks)
        {
            e.to.inputs.set(e.toIndex, unthreshOutput);
        }
    }

    @Override
    public void backPropagate()
    {
        // do nothing for input nodes
    }

    @Override
    public void updateWeights(double eta, double momentum, double decay)
    {
        // do nothing for input nodes
    }

    public void input(float value)
    {
        inputs.set(0, value);
    }

    public void input(double value)
    {
        inputs.set(0, (float) value);
    }
}
